import request from "../utils/request"

/**
 * 文章请求API
 */

// 文章信息
export const loadArticleData = params => {
    return request({
        method: 'GET',
        url: '/queryArticleByCondition',
        params: params
    })
}

// 查询编辑文章信息
export const queryArticleById = params => {
    return request({
        method: 'GET',
        url: '/queryArticleById',
        params: params
    })
}

// 更新文章信息
export const updateArticle = params => {
    return request({
        method: 'POST',
        url: '/updateArticle',
        data: params
    })
}

// 查询文章其他信息（观看次数，收藏次数,点赞次数等）
export const queryArticleRedisInfo = params => {
    return request({
        method: 'GET',
        url: '/queryArticleRedisInfo',
        params: params
    })
}

// 点赞
export const onLike = params => {
    return request({
        method: 'POST',
        url: '/like',
        data: params
    })
}
// 取消点赞
export const cancelLike = params => {
    return request({
        method: 'POST',
        url: '/cancelLike',
        data: params
    })
}
// 收藏
export const onCollection = params => {
    return request({
        method: 'POST',
        url: '/collection',
        data: params
    })
}
// 取消收藏
export const cancelCollection = params => {
    return request({
        method: 'POST',
        url: '/cancelCollection',
        data: params
    })
}
// 是否点赞
export const isLike = params => {
    return request({
        method: 'GET',
        url: '/isLike',
        params: params
    })
}
// 是否收藏
export const isCollection = params => {
    return request({
        method: 'GET',
        url: '/isCollection',
        params: params
    })
}
// 点赞数量
export const getLikeCount = params => {
    return request({
        method: 'GET',
        url: '/getLikeCount',
        params: params
    })
}
// 收藏数量
export const getCollectionCount = params => {
    return request({
        method: 'GET',
        url: '/getCollectionCount',
        params: params
    })
}
